using System;
using System.Threading.Tasks;
using JlPay.Sdk.Core;
using JlPay.Sdk.Models.BaseData;

namespace JlPay.Sdk.Services
{
    /// <summary>
    /// 公共基础数据服务类
    /// </summary>
    public class BaseDataService : BaseService
    {
        public BaseDataService(Config config) : base(config)
        {
        }

        /// <summary>
        /// 查询银行总行信息
        /// </summary>
        /// <param name="request">请求对象</param>
        /// <returns>响应对象</returns>
        public async Task<BankListResponse> QueryBankListAsync(BankListRequest request)
        {
            return await PostAsync<BankListRequest, BankListResponse>(request, BankListRequest.API_URL);
        }

        /// <summary>
        /// 查询分支行信息
        /// </summary>
        /// <param name="request">请求对象</param>
        /// <returns>响应对象</returns>
        public async Task<BankBranchListResponse> QueryBankBranchListAsync(BankBranchListRequest request)
        {
            return await PostAsync<BankBranchListRequest, BankBranchListResponse>(request, BankBranchListRequest.API_URL);
        }

        /// <summary>
        /// 查询MCC信息
        /// </summary>
        /// <param name="request">请求对象</param>
        /// <returns>响应对象</returns>
        public async Task<MccQueryResponse> QueryMccAsync(MccQueryRequest request)
        {
            return await PostAsync<MccQueryRequest, MccQueryResponse>(request, MccQueryRequest.API_URL);
        }

        /// <summary>
        /// 查询地区码信息
        /// </summary>
        /// <param name="request">请求对象</param>
        /// <returns>响应对象</returns>
        public async Task<RegionListResponse> QueryRegionListAsync(RegionListRequest request)
        {
            return await PostAsync<RegionListRequest, RegionListResponse>(request, RegionListRequest.API_URL);
        }

        /// <summary>
        /// 查询银行卡bin信息
        /// </summary>
        /// <param name="request">请求对象</param>
        /// <returns>响应对象</returns>
        public async Task<BankCardBinMatchingResponse> QueryBankCardBinAsync(BankCardBinMatchingRequest request)
        {
            return await PostAsync<BankCardBinMatchingRequest, BankCardBinMatchingResponse>(request, BankCardBinMatchingRequest.API_URL);
        }
    }
} 